home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / dinorobot_scripts.lua < prev    next >
Encoding:
Text File  |  2005-03-09  |  7.8 KB  |  203 lines

  1.  
  2. function units_dinorobot_setup()
  3.     units_setup(11,true,ENET_EFFECT_PS_SETUPSMOKE_LARGE,ENET_EFFECT_GEOMETRY_DINOROBOTSHADOW)
  4. end
  5.  
  6. function units_dinorobot_resetup()
  7.     units_setup(11,true,nil,ENET_EFFECT_GEOMETRY_DINOROBOTSHADOW)
  8. end
  9.  
  10. function units_dinorobot_select()
  11.     units_select(25,2)
  12. end
  13.  
  14. function units_dinorobot_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_dinorobot_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_dinorobot_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_dinorobot_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_dinorobot_explode()
  31.     units_explode_xxl2()
  32. end
  33.  
  34. function units_dinorobot_fire1()
  35.     uniSetLife(uniGetLife() / 5.0)
  36.     local unit = uniGetExecutor()
  37.     if(unit:getObjectPositionInLocalSpace(uniGetTarget()).z > 0) then
  38.         unit:play3DSound("bull gun rotate.wav",0)
  39.         waitDeath(unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  40.     else
  41.         waitDeath(unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI))
  42.         unit:play3DSound("bullfrog turn3.wav",0)
  43.         unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  44.         waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI * 0.35,uniGetTarget()))
  45.         unit:setCurrentAnimationRepeatCount(1)
  46.         while(unit:getCurrentAnimation() == ENAT_TURNING) do pause() end
  47.     end
  48.     local gun_rotation = unit:getBone(ENBT_RECOIL,0):addRotationEffect(ENET_EFFECT_ROTATE_SPIRAL,MATH_PI * 6.0)
  49.     waitDeath(unit:getBone(ENBT_GUN):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  50.     local firespot = unit:getBone(ENBT_FIRE1,0)
  51.     local i = 0
  52.     for i = 0,4 do
  53.         unit:play3DSound("bull fire1.wav",0)
  54.         firespot:addSimpleEffect(ENET_EFFECT_DINOROBOTSHOT_FLY):executeCommand(ENC_FIRE1)
  55.         firespot:addBulletEffect(ENET_EFFECT_PS_DOTALIENSHOT):suspendedDestroy(0.5)
  56.         pause(0.2)
  57.     end
  58.     pause(0.5)
  59.     gun_rotation:destroy()
  60.     unit:getBone(ENBT_RECOIL,0):addRotationEffect(ENET_EFFECT_ROTATE_SPIRAL,MATH_PI * 3.0):delayedDestroy(1.0)
  61.     unit:addFireArrow()
  62. end
  63.  
  64. function units_dinorobot_fire2()
  65.     uniSetLife(uniGetLife() / 2.0)
  66.     local unit = uniGetExecutor()
  67.     local firespots = {}
  68.     firespots[0] = unit:getBone(ENBT_FIRE2,0)
  69.     firespots[1] = unit:getBone(ENBT_FIRE2,1)
  70.     local recoils = {}
  71.     recoils[0] = unit:getBone(ENBT_RECOIL,2)
  72.     recoils[1] = unit:getBone(ENBT_RECOIL,1)
  73.     unit:play3DSound("bullfrog turn3.wav",0)
  74.     unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  75.     waitDeath(unit:parabolicTargetting(uniGetTarget(),unit:getBone(ENBT_FIRE2,0),MATH_PI * 0.35))
  76.     unit:setCurrentAnimationRepeatCount(1)
  77.     while(unit:getCurrentAnimation() == ENAT_TURNING) do pause() end
  78.     unit:play3DSound("bull fire2.wav",0)
  79.     firespots[0]:addSimpleEffect(ENET_EFFECT_DINOROBOTSHOT_FLY2):executeCommand(ENC_FIRE2)
  80.     firespots[0]:addSimpleEffect(ENET_EFFECT_PS_DINOROBOTSHOT):suspendedDestroy(1.5)
  81.     recoils[0]:gunRecoil(0,0.2,10)
  82.     pause(1.0)
  83.     unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  84.     unit:play3DSound("bullfrog turn3.wav",0)
  85.     waitDeath(unit:parabolicTargetting(uniGetTarget(),unit:getBone(ENBT_FIRE2,1),MATH_PI * 0.35))
  86.     unit:play3DSound("explosion.wav",0)
  87.     unit:setCurrentAnimationRepeatCount(1)
  88.     while(unit:getCurrentAnimation() == ENAT_TURNING) do pause() end
  89.     unit:play3DSound("bull fire2.wav",0)
  90.     firespots[1]:addSimpleEffect(ENET_EFFECT_DINOROBOTSHOT_FLY2):executeCommand(ENC_FIRE2)
  91.     firespots[1]:addSimpleEffect(ENET_EFFECT_PS_DINOROBOTSHOT):suspendedDestroy(1.5)
  92.     recoils[1]:gunRecoil(0,0.2,10)
  93.     pause(1.0)
  94.     unit:play3DSound("explosion.wav",0)
  95.     unit:addFireArrow()
  96. end
  97.  
  98. function units_dinorobot_move()
  99.     local unit = uniGetExecutor()
  100.     local sound = unit:play3DSound("bullfrog turn3.wav",1)
  101.         unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  102.     unit:addAnimationToQueue(ENAT_IDLETIMEOUT1,1)
  103.     unit:addAnimationToQueue(ENAT_IDLETIMEOUT2,1)
  104.     unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
  105.     local steps = {}
  106.     steps[0] = unit:getBone(ENBT_STEPEMITTER,0):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_BULLFROGSTEPSEMITTER_LEFT)
  107.     steps[1] = unit:getBone(ENBT_STEPEMITTER,1):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_BULLFROGSTEPSEMITTER_RIGHT)
  108.     for i = 0,1 do
  109.         steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_TRACKSMOKE)
  110.     end
  111.     steps[4] = unit:getBone(ENBT_STEPEMITTER,2):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_BULLFROGSTEPSEMITTERSMALL_LEFT)
  112.     steps[5] = unit:getBone(ENBT_STEPEMITTER,3):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_BULLFROGSTEPSEMITTERSMALL_RIGHT)
  113.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.35))
  114.         unit:setCurrentAnimationRepeatCount(1)
  115.     while unit:getCurrentAnimation() ~= ENAT_IDLETIMEOUT2 do
  116.         pause()
  117.     end;
  118.     sound:destroy()
  119.     sound = unit:play3DSound("bullfrog moves.wav",1)
  120.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,64))
  121.     unit:resetAnimations()
  122.     sound:destroy()
  123.     unit:addAnimationToQueue(ENAT_SELECTED,1)
  124.     while(unit:getCurrentAnimation() == ENAT_SELECTED) do pause() end
  125.     for i = 0,1 do
  126.         if(unit:getScale() < 1.0) then 
  127.             steps[i]:destroy()
  128.         else
  129.             steps[i]:setTransformOwner()
  130.             steps[i]:suspendedDestroy(70)
  131.         end
  132.         steps[i+2]:suspendedDestroy(1.0)
  133.     end
  134.     for i = 4,5 do
  135.         if(unit:getScale() < 1.0) then 
  136.             steps[i]:destroy()
  137.         else
  138.             steps[i]:setTransformOwner()
  139.             steps[i]:suspendedDestroy(70)
  140.         end
  141.     end
  142. end
  143.  
  144. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_MOVE,"units_dinorobot_move")
  145. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_FIRE1,"units_dinorobot_fire1")
  146. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_FIRE2,"units_dinorobot_fire2")
  147. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_SELECT,"units_dinorobot_select")
  148. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_SELECTENEMY,"units_dinorobot_selectenemy")
  149. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_UNSELECT,"units_dinorobot_unselect")
  150. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_SETUP,"units_dinorobot_setup")
  151. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_RESETUP,"units_dinorobot_resetup")
  152. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_DAMAGED,"units_dinorobot_damaged")
  153. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_EXPLODE,"units_dinorobot_explode")
  154. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_HIGHLIGHT,"units_dinorobot_highlight")
  155. registerCommand(ENSCRIPTSET_DINOROBOT,ENC_INSIDE,"units_inside")
  156.  
  157. -- make description of unit
  158. desc = getEffectDescriptionP(ENET_UNIT_DINOROBOT)
  159. desc.ClassID = ENCLASS_MESHINSTANCE
  160. desc.EffectClassType = ENECT_GEOMETRY
  161. desc.FileName = "dinorobot.rmd"
  162. desc.ScriptSet = ENSCRIPTSET_DINOROBOT
  163. desc.MoveType = ENMOVE_GROUND
  164. desc.RenderType = ENRENDERTYPE_GEOMETRY
  165. desc.Material = ENMAT_RIGIDSKINNEDMESH
  166. desc.MaterialColors = units_materialcolors_human
  167.  
  168. -- shadow
  169. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_DINOROBOTSHADOW)
  170. desc.ClassID = ENCLASS_MESHINSTANCE
  171. desc.EffectClassType = ENECT_GEOMETRY
  172. desc.FileName = "dinorobot_shadow.rmd"
  173. desc.RenderType = ENRENDERTYPE_SHADOW
  174. desc.Material = ENMAT_SHADOW
  175. desc.MaterialColors = units_materialcolors_shadow
  176.  
  177. -- register new unit to logic
  178. unitDesc = logic_getUnitDescP(34)
  179. unitDesc.group = 0
  180. unitDesc.order = 5
  181. unitDesc.unit_res_id = ENET_UNIT_DINOROBOT
  182. unitDesc.unit_icon_id = "Bullfrog_a_small_normal.dds"
  183. unitDesc.active_id = "Bullfrog_a_small_active.dds"
  184. unitDesc.pressed_id = "Bullfrog_a_small_pressed.dds"
  185. unitDesc.small_icon_id = "Bullfrog_l_stats.dds"
  186. unitDesc.big_icon_id = "Bullfrog_a_big_normal.dds"
  187. unitDesc.HP = 11
  188. unitDesc.MP = 20
  189. unitDesc.WR = 2
  190. unitDesc.min_WR = 0
  191. unitDesc.WD = 2
  192. unitDesc.WR2 = 2
  193. unitDesc.min_WR2 = 0
  194. unitDesc.WD2 = 3
  195. unitDesc.ability = 1
  196. unitDesc.transport = 0
  197. unitDesc.value = 6
  198. unitDesc.race = 1
  199. unitDesc.fire_pause = 0.6
  200. unitDesc.move_pause = 0.5
  201. unitDesc.unit_info_scale = 0.07
  202. unitDesc.scn_name = "SUPEROSTRICH"
  203.